﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using BITC.Library.Provider;
using VVA.Data.Entity;

namespace VVA.Data.Service
{
    public class TaxonomyService
    {
        #region Declaration

        #endregion

        #region Method

        public Taxonomy GetByID(Guid id)
        {
            return SqlDataProvider.CreateInstance().ExecuteCollection<Taxonomy>("Proc_Taxonomy_SelectById", id).FirstOrDefault();
        }

        public IList<Taxonomy> GetAll(string table, string culture)
        {
            return SqlDataProvider.CreateInstance().ExecuteCollection<Taxonomy>("Proc_Taxonomy_SelectByAppliedTable", table, culture);
        }

        public IList<Taxonomy> GetAllByParentSlug(string parentSlug, string culture)
        {
            return SqlDataProvider.CreateInstance().ExecuteCollection<Taxonomy>("Proc_Taxonomy_SelectByParentSlug", parentSlug, culture);
        }

        public void Insert(Taxonomy entity)
        {
            SqlDataProvider.CreateInstance().ExecuteNonQuery("Proc_Taxonomy_Insert", entity);
        }

        public void Delete(Taxonomy entity)
        {
            SqlDataProvider.CreateInstance().ExecuteNonQuery("Proc_Taxonomy_Delete", entity);
        }

        public void Update(Taxonomy entity)
        {
            SqlDataProvider.CreateInstance().ExecuteNonQuery("Proc_Taxonomy_Update", entity);
        }

        #endregion
    }
}
